<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglibs.jsp" %>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta content="always" name="referrer">
    <title>设备故障管理</title>
    <link href="${ctxstatic}/css/custom-style.css" rel="stylesheet" type="text/css">

    <%@ include file="/WEB-INF/views/include/common.jsp" %>
    <style>
        .QueryBar input{
            width: 180px;
        }
        .QueryBar select{
            width: 180px;
        }

        #preview_table p{
            font-size: 16px;
        }
        #preview_table td{
            margin: 0px;
            padding: 10px;
        }
    </style>
    <script>
        var username = "${user.username}";
    </script>
</head>

<body class="easyui-layout">
<div data-options="region:'north',border:false" style="padding: 10px 5px;">
    <span class="QueryBar">
        <select id="fault_type" class="easyui-combobox" data-options="label:'故障类型',limitToList:true">
            <option value="0">元器件（物料）问题</option>
            <option value="1">结构设计问题</option>
            <option value="2">软件问题</option>
            <option value="3">装配工艺问题</option>
            <option value="4">其他问题</option>
        </select>
        <input id="maintenance_person" class="easyui-textbox" data-options="label:'维修人'" />
        <input id="device_name" class="easyui-textbox" data-options="label:'设备名称'" />
        <input id="device_num" class="easyui-textbox" data-options="label:'设备编号'" />
        <select id="workshop" class="easyui-combobox" data-options="label:'车间',limitToList:true">
            <option value="一期4楼插件车间">一期4楼插件车间</option>
            <option value="一期4楼网关车间">一期4楼网关车间</option>
            <option value="一期2楼整机组测包车间">一期2楼整机组测包车间</option>
            <option value="NB模组车间(NB-lot)">NB模组车间(NB-lot)</option>
        </select>

        <select id="line_id" class="easyui-combobox" data-options="label:'线体',limitToList:true"></select>

        <span>
            <input id="start_fault_date" class="easyui-datebox" name="start_fault_date" data-options="label:'时间首'">
            -
            <input id="end_fault_date" class="easyui-datebox" name="end_fault_date" data-options="label:'时间尾'">
        </span>
        <span style="margin-top: 5px">
             <a href="javascript:void(0)" onclick="queryRecord()" class="easyui-linkbutton button-blue" style="width: 50px;margin-left: 10px;">查询</a>
            <a href="javascript:void(0)" onclick="exportexcel()" class="easyui-linkbutton button-blue" style="width: 140px;margin-left: 10px;">按条件导出</a>
        </span>

    </span>
</div>
<div data-options="region:'center',border:false" style="height:100%">
    <table id="list">

    </table>
    <!-- 工具条 -->
    <div id="toolbar">
        <a id="addBtn" href="javascript:void(0)" onclick="add()" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加</a>
        <a id="editBtn" href="javascript:void(0)" onclick="edit()" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">修改</a>
        <a id="deleteBtn" href="javascript:void(0)" onclick="remove()" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">删除</a>
    </div>
</div>

<div id="dlg_fault">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'center',border:false" style="height:100%;">
            <form id="form_fault">
                <table style="margin: 0 auto; padding: 10px;">
                    <tr>
                        <td align="right">故障类型:</td>
                        <td>
                            <select id="form_fault_type" name="fault_type" class="easyui-combobox" data-options="required:true,limitToList:true">
                                <option value="0">元器件（物料）问题</option>
                                <option value="1">结构设计问题</option>
                                <option value="2">软件问题</option>
                                <option value="3">装配工艺问题</option>
                                <option value="4">其他问题</option>
                            </select>
                        </td>
                        <td align="right">修复时长(分):</td>
                        <td>
                            <input data-options="required:true" style="width: 100%" id="form_maintenance_time" name="maintenance_time" class="easyui-textbox"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">维修人:</td>
                        <td>
                            <input data-options="required:true" id="form_maintenance_person" name="maintenance_person" class="easyui-textbox"/>
                        </td>
                        <td align="right">线体:</td>
                        <td>
                            <select data-options="required:true,limitToList:true" style="width: 100%" id="form_line_id" name="line_id" class="easyui-combobox"></select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">设备:</td>
                        <td>
                            <select style="width: 100%" data-options="required:true,limitToList:true" id="form_device_id" name="device_id" class="easyui-combobox"></select>
                        </td>
                        <td align="right">故障日期:</td>
                        <td>
                            <input id="fault_date" style="width: 100%" data-options="required:true" class="easyui-datebox" name="fault_date">
                        </td>
                    </tr>
                    <tr>
                        <td align="right">故障现象:</td>
                        <td colspan="3">
                            <input id="form_fault_phenomenon" style="width: 100%;height: 80px;" name="fault_phenomenon" data-options="multiline:true" class="easyui-textbox"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">故障分析:</td>
                        <td colspan="3">
                            <input id="form_analyse" style="width: 100%;height: 80px;" name="analyse" data-options="multiline:true" class="easyui-textbox"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">维修措施:</td>
                        <td colspan="3">
                            <input id="form_maintenance_measures" style="width: 100%;height: 80px;" name="maintenance_measures" data-options="multiline:true" class="easyui-textbox"/>
                        </td>
                    </tr>
                    <tr class="Unit_Add_Option">
                        <td align="right">单元添加:</td>
                        <td colspan="3">
                            <span><select id="form_unit_temp" style="width: 260px;" class="easyui-combobox" data-options="limitToList:true"></select></span>
                            <span><input id="form_unit_count_temp" style="width: 101px;" data-options="label:'数量'" class="easyui-textbox"/></span>
                            <span><a href="javascript:void(0)" onclick="addunit()" class="easyui-linkbutton button-blue" style="width: 60px;">添加</a></span>
                        </td>
                    </tr>
                    <tr class="Unit_Add_Option">
                        <td align="right"></td>
                        <td colspan="3">
                            <ul id="form_unit_list_temp" data-options="valueField:'form_unit_temp',textFormatter:textFormatter,onDblClickRow:ListOnDblClickRow" class="easyui-datalist" title="故障单元列表" style="width:100%;height:150px">

                            </ul>
                        </td>
                    </tr>
                    <tr class="Unit_Add_Option">
                        <td align="right"></td>
                        <td colspan="3">
                            <label style="color: red">* 双击项可移除该项</label>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">备注:</td>
                        <td colspan="3">
                            <input id="form_remark" style="width: 100%;height: 80px;" name="remark" data-options="multiline:true" class="easyui-textbox"/>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<div id="dlg_fault_preview">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'center',border:false" style="height:100%;">
                <table id="preview_table" border="2px" style="margin: 0 auto; padding: 10px;width: 800px;">
                    <tr>
                        <td align="right">车间:</td>
                        <td colspan="3">
                            <p id="preview_workshop" name="preview_workshop"></p>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">故障类型:</td>
                        <td >
                            <p id="preview_fault_type" name="preview_fault_type"></p>
                        </td>
                        <td align="right">修复时长(分):</td>
                        <td>
                            <p id="preview_maintenance_time" name="preview_maintenance_time">
                        </td>
                    </tr>
                    <tr>
                        <td align="right">维修人:</td>
                        <td>
                            <p id="preview_maintenance_person" name="preview_maintenance_person"></p>
                        </td>
                        <td align="right">线体名称:</td>
                        <td>
                            <p id="preview_line_name" name="preview_line_name"></p>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">设备:</td>
                        <td>
                            <p id="preview_device_name" name="preview_device_name"></p>
                        </td>
                        <td align="right">故障现象:</td>
                        <td>
                            <p id="preview_fault_phenomenon" name="preview_fault_phenomenon"></p>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">故障分析:</td>
                        <td>
                            <p id="preview_analyse" name="preview_analyse"></p>
                        </td>
                        <td align="right">维修措施:</td>
                        <td>
                            <p id="preview_maintenance_measures" name="preview_maintenance_measures"></p>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">备注:</td>
                        <td colspan="3">
                            <p id="preview_remark" name="preview_remark"></p>
                        </td>
                    </tr>
                </table>
        </div>
    </div>
</div>
<div id="dlg_details">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'center',border:false" style="height:100%;">
            <table id="details_list">

            </table>
            <!-- 工具条 -->
            <div id="details_list_toolbar">
                <a id="addDtlBtn" href="javascript:void(0)" onclick="addDtl()" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加</a>
                <a id="editDtlBtn" href="javascript:void(0)" onclick="editDtl()" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">修改</a>
                <a id="deleteDtlBtn" href="javascript:void(0)" onclick="removeDtl()" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">删除</a>
            </div>
        </div>
    </div>
</div>

<div id="dlg_dtl">
    <div class="easyui-layout" data-options="fit:true,border:false">
        <div data-options="region:'center',border:false" style="height:100%;">
            <input id="dlg_faultid" name="id" style="display: none">
            <form id="form_dtl">
                <table style="margin: 0 auto; padding: 10px;">
                    <tr>
                        <td align="right">对应配件:</td>
                        <td colspan="2">
                            <select id="type_dtl_id" style="width: 200px" data-options="limitToList:true" name="type_dtl_id" class="easyui-combobox"></select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right"></td>
                        <td colspan="2">
                            <label style="color: red">* 输入字符支持快速过滤</label>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">数量:</td>
                        <td colspan="2">
                            <input id="unit_count" name="unit_count" class="easyui-textbox"/>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
</body>
<script src="${ctxstatic}/plugin/easyui/themes/insdep/expand/jquery-easyui-datagridview/datagrid-groupview.js" type="text/javascript"></script>
<script src="${ctxstatic}/js/faultManage/fault_Item_Manage.js" type="text/javascript"></script>
</html>